﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Frame.Lib.Core.Tree;
using Frame.Lib.Core.Dept;
using Frame.Lib.Utilities;
using Frame.Lib.Core;


public partial class Contact_Inner_DeptTree : System.Web.UI.Page
{
    private TreeBO<DeptInfo> _tree = new TreeBO<DeptInfo>(STableName.Dept);
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            HtmlGenericControl body = (HtmlGenericControl)this.Master.Page.Form.FindControl("body");
            body.Attributes.Add("class", "left_body_bg");
            BindTree();
            JSUtil.SetDivHeight("tree", 30);
        }
    }

    private void BindTree()
    {
        int rootID = (int)_tree.GetRootID();

        string navigateUrl = "List.aspx?DeptID=";
        lnkRoot.NavigateUrl = navigateUrl + StrUtil.EncryptUrl(rootID);
        lnkRoot.Text = _tree.GetName(rootID);

        _tree.BindTreeView(tv, null, null, rootID, navigateUrl);
    }
}
